package com.mck.mapper;

import com.mck.entity.ScoreTotal;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @version 1.0.0
 * @Author mck
 * @Date 2025/4/16 上午11:07
 * @注释
 */

@Mapper
public interface ScoreTotalMapper {

    /**
     * 计算总分
     */
    List<ScoreTotal> computeScoreTotal(ScoreTotal scoreTotal);

    /**
     * 统计排名
     */
    void updateTheoryRank();
    void updatePracticeRank();

    /**
     * 添加总分
     */
    @Insert("insert into score_total(user_id, academy_year, class_id, theory_total, practice_total, update_time) values (#{userId},#{academyYear},#{classId},#{theoryTotal},#{practiceTotal},#{updateTime})")
    void addScoreTotal(ScoreTotal scoreTotal);

    /**
     * 获取总分
     */
    List<ScoreTotal> getScoreTotalList(ScoreTotal scoreTotal);

    /**
     * 添加总分
     */
    void batchUpsertScoreTotal(List<ScoreTotal> scoreTotal);

    /**
     * 更新总分
     */
    // void updateScoreTotal(ScoreTotal scoreTotal);
}
